package com.zjp.service.impl;

import com.zjp.mapper.CustomerMapper;
import com.zjp.po.Customer;
import com.zjp.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional//添加事务注解
public class CustomerServiceImpl implements CustomerService {
    @Autowired
    private CustomerMapper customerMapper;

    @Override
    public void addCustomer(Customer customer) {
        customerMapper.addCustomer(customer);
        int i = 1/0;//模拟异常
    }
}
